package com.utooo.controller;


import com.utooo.constant.ResultCodeConstant;
import com.utooo.pojo.dto.common.CreateGroup;
import com.utooo.pojo.dto.common.RestResult;
import com.utooo.pojo.dto.quality.RectificationPushDto;
import com.utooo.service.quality.RectificationService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * @Description: TODO
 * @Author SJD
 * @Date: 2025/4/28 10:00
 * @Copyright: 南京优通信息科技股份有限公司
 */
@Tag(name = "质量管理-推送质量整改措施相关api")
@RequestMapping("/rectification")
@RestController
@RequiredArgsConstructor
public class RectificationController {

    private final RectificationService rectificationServiceImpl;


    @RequestMapping(value = "/pushCorrectiveAction", method = RequestMethod.POST)
    @Operation(summary = "采购方推送8D整改到供应商门户")
    @ResponseBody
    public RestResult<Boolean> pushCorrectiveAction(@RequestBody @Validated(CreateGroup.class) RectificationPushDto param) {
        Boolean result = rectificationServiceImpl.pushCorrectiveAction(param);
        return new RestResult<>(ResultCodeConstant.CODE_200, ResultCodeConstant.CODE_200_MSG, result);
    }

    @RequestMapping(value = "/pushGeneralAction", method = RequestMethod.POST)
    @Operation(summary = "采购方推送一般整改到供应商门户")
    @ResponseBody
    public RestResult<Boolean> pushGeneralAction(@RequestBody @Validated(CreateGroup.class) RectificationPushDto param) {
        Boolean result = rectificationServiceImpl.pushGeneralAction(param);
        return new RestResult<>(ResultCodeConstant.CODE_200, ResultCodeConstant.CODE_200_MSG, result);
    }
}
